<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.form.js"></script>
  	<script type="text/javascript">
  	function checkUserName(obj){
		var email = obj.value.trim();
		var path = "${pageContext.request.contextPath }/user/checkUserName.action?"+new Date();
		var data = {'email':email};
		$.post(path,data,function(data,state,ajax){
			var v = ajax.responseText;
			$("#msg").html(v);
			//验证成功
			if(v.indexOf("不")>0){
				$("#checkName").val("false");
			}
		});
	}
		function registSubmit(){
			
			 if($("#inputPassword").val().length<5){
					$("#msg").html("<span style='color:red'>密码至少为5位！</span>");
				 return false;
			 }
			return true;
		}
		</script>
</head>
<body>
	<%@include file="jsp/bootstrap/top_css.jsp"%>
	<div class="admin-form">
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<!-- Widget starts -->
					<div class="widget worange">
						<!-- Widget head -->
						<div class="widget-head">
							<i class="icon-lock"></i> Login
						</div>
						<div class="widget-content">
							<div class="padd">
								<!-- Login form -->
								<form class="form-horizontal" action="${pageContext.request.contextPath }/user/loginUser.action" method="post" onsubmit="return registSubmit()">
	                    <!-- Email -->
	                    <div class="form-group">
	                      <label class="control-label col-lg-3" for="inputEmail">邮箱</label>
	                      <div class="col-lg-9">
	                        <input type="text" class="form-control" name="email" id="inputEmail" placeholder="Email" onblur="checkUserName(this)" required="required" value="${user.email }">
	                      	<input  type="hidden" id="checkName" value="false"><!-- 如果改值为 true 可以提交  -->
	                      </div>
	                    </div>
	                    <!-- Password -->
	                    <div class="form-group">
	                      <label class="control-label col-lg-3" for="inputPassword">密码</label>
	                      <div class="col-lg-9">
	                        <input type="password" class="form-control" name="pwd" id="inputPassword" placeholder="Password" required="required" value="${user.pwd }">
	                      </div>
	                    </div>
	                    <!-- Remember me checkbox and sign in button -->
	                    <div class="form-group">
						<div class="col-lg-9 col-lg-offset-3">
	                      <div class="checkbox">
	                        <label>
	                          <input type="checkbox"> 记住我<br>
	                        </label>
	                        <font color="red"><b id="msg">${msg }</b></font>
							</div>
						</div>
						</div>
	                        <div class="col-lg-9 col-lg-offset-2">
								<input type="submit" class="btn btn-danger" value="登陆">
								<input type="reset" class="btn btn-default" value="重置">
							</div>
	                    <br />
	                  </form>

							</div>
						</div>

						<div class="widget-foot">
							还没注册? <a href="${pageContext.request.contextPath }/register.jsp">这里注册</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<%@include file="jsp/bootstrap/bottom_JS.jsp"%>
</body>
</html>